﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using GWEB.WebBase.Entity;
using GWEB.WebBase.Utility;
using GWEB.WebFrame.Public;

namespace GWEB.WebFrame.Models
{
    public class Time
    {
        public PageInfo Init()
        {
            PageInfo pg = new PageInfo();
            pg.Type = "Time";
            pg.Title = "上课时段";            
            pg.AddText = "上课时段增加";
            pg.EditText = "上课时段修改";
            pg.LocateText = "上课时段查询";
            pg.SMenuId = "JX08";
            pg.FileUrl = "../Schedule/Time";
            pg.Condition = "";
            pg.TableName = "cu_Time";
            pg.KeyFieldName = "id";
            pg.PopEditHeight = 380;
            pg.PopEditWidth = 360;
            HttpSessionState session = System.Web.HttpContext.Current.Session;
            pg.dict = BasePage.getDict(session);            
            pg.Sop = BasePage.Grant(session, pg.SMenuId);
            pg.Sql = @"select * from ( 
                        select t1.*,t2.name leagueName,case when t1.state=1 then '启用' else '禁用' end stateCn
                        from cu_Time t1
                        left join cu_Sys_league t2 on t1.LeagueId=t2.id                 
                    ) cu_Time where 1=1 ";
            ColumnInfo cl;
            cl = new ColumnInfo(); cl.FieldName = "startTime"; cl.HeadText = "开始时间"; cl.IsCondition = true; cl.IsCheck = true; cl.Length = 5; cl.IsNull = false; cl.ErrMessage = cl.HeadText + ":必填且长度不能超过" + cl.Length; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "endTime"; cl.HeadText = "结束时间"; cl.IsCondition = true; cl.IsCheck = true; cl.Length = 5; cl.IsNull = false; cl.ErrMessage = cl.HeadText + ":必填且长度不能超过" + cl.Length; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "leagueName"; cl.HeadText = "加盟商"; cl.IsCondition = true;pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "state"; cl.HeadText = "状态"; cl.Visible = false; cl.IsCondition = true; cl.DictTypeID = "A02"; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "stateCn"; cl.HeadText = "状态"; pg.AddColumn(cl);
            return pg;
        }
    }
}